﻿USE [master]
GO


/*****************需要修改数据库名称，数据库存放路径 ****************************/
/*****************需要修改数据库名称，数据库存放路径 ****************************/
/*****************需要修改数据库名称，数据库存放路径 ****************************/



/****** Object:  Database QrCodeTest    Script Date: 2016/7/12 11:46:41 ******/
CREATE DATABASE QrCodeTest
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'QrCodeTest', FILENAME = N'E:\Program Files (x86)\SQL Server2012\MSSQL11.MSSQLSERVER\MSSQL\DATA\QrCodeTest.mdf' , SIZE = 5120KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'QrCodeTest_log', FILENAME = N'E:\Program Files (x86)\SQL Server2012\MSSQL11.MSSQLSERVER\MSSQL\DATA\QrCodeTest_log.ldf' , SIZE = 10176KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE QrCodeTest SET COMPATIBILITY_LEVEL = 110
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC QrCodeTest.[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE QrCodeTest SET ANSI_NULL_DEFAULT OFF 
GO

ALTER DATABASE QrCodeTest SET ANSI_NULLS OFF 
GO

ALTER DATABASE QrCodeTest SET ANSI_PADDING OFF 
GO

ALTER DATABASE QrCodeTest SET ANSI_WARNINGS OFF 
GO

ALTER DATABASE QrCodeTest SET ARITHABORT OFF 
GO

ALTER DATABASE QrCodeTest SET AUTO_CLOSE OFF 
GO

ALTER DATABASE QrCodeTest SET AUTO_CREATE_STATISTICS ON 
GO

ALTER DATABASE QrCodeTest SET AUTO_SHRINK OFF 
GO

ALTER DATABASE QrCodeTest SET AUTO_UPDATE_STATISTICS ON 
GO

ALTER DATABASE QrCodeTest SET CURSOR_CLOSE_ON_COMMIT OFF 
GO

ALTER DATABASE QrCodeTest SET CURSOR_DEFAULT  GLOBAL 
GO

ALTER DATABASE QrCodeTest SET CONCAT_NULL_YIELDS_NULL OFF 
GO

ALTER DATABASE QrCodeTest SET NUMERIC_ROUNDABORT OFF 
GO

ALTER DATABASE QrCodeTest SET QUOTED_IDENTIFIER OFF 
GO

ALTER DATABASE QrCodeTest SET RECURSIVE_TRIGGERS OFF 
GO

ALTER DATABASE QrCodeTest SET  DISABLE_BROKER 
GO

ALTER DATABASE QrCodeTest SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO

ALTER DATABASE QrCodeTest SET DATE_CORRELATION_OPTIMIZATION OFF 
GO

ALTER DATABASE QrCodeTest SET TRUSTWORTHY OFF 
GO

ALTER DATABASE QrCodeTest SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO

ALTER DATABASE QrCodeTest SET PARAMETERIZATION SIMPLE 
GO

ALTER DATABASE QrCodeTest SET READ_COMMITTED_SNAPSHOT OFF 
GO

ALTER DATABASE QrCodeTest SET HONOR_BROKER_PRIORITY OFF 
GO

ALTER DATABASE QrCodeTest SET RECOVERY FULL 
GO

ALTER DATABASE QrCodeTest SET  MULTI_USER 
GO

ALTER DATABASE QrCodeTest SET PAGE_VERIFY CHECKSUM  
GO

ALTER DATABASE QrCodeTest SET DB_CHAINING OFF 
GO

ALTER DATABASE QrCodeTest SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO

ALTER DATABASE QrCodeTest SET TARGET_RECOVERY_TIME = 0 SECONDS 
GO

EXEC sys.sp_db_vardecimal_storage_format N'QrCodeTest', N'ON'
GO

USE QrCodeTest

CREATE TABLE [dbo].[Customer](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[UserName] [NVARCHAR](32) NOT NULL,
	[Password] [VARCHAR](32) NOT NULL,
	[IsEnable] [BIT] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[EmployeeRecord](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[Name] [VARCHAR](200) NULL,
	[IdCard] [VARCHAR](50) NOT NULL,
	[Gender] [INT] NOT NULL,
	[HeadImg] [VARCHAR](50) NULL,
	[BloodType] [VARCHAR](50) NULL,
	[Mobile] [VARCHAR](50) NULL,
	[Birthday] [DATETIME] NULL,
	[Hometown] [VARCHAR](200) NULL,
	[UrgentContactName] [VARCHAR](200) NULL,
	[UrgentContactNum] [VARCHAR](50) NULL,
	[JobType] [VARCHAR](50) NULL,
	[ServiceCompany] [VARCHAR](200) NULL,
	[CompanyContactName] [VARCHAR](200) NULL,
	[CompanyContactNum] [VARCHAR](200) NULL,
	[ImgUrl] [VARCHAR](200) NULL,
	[TagId] [VARCHAR](50) NOT NULL,
	[TagName] [VARCHAR](50) NOT NULL,
	[UpdateTime] [DATETIME] NULL,
 CONSTRAINT [PK_EmployeeRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[FloorRecord](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[TagId] [NVARCHAR](50) NOT NULL,
	[TagName] [NVARCHAR](50) NOT NULL,
	[ImgUrl] [NVARCHAR](200) NULL,
	[Name] [NVARCHAR](50) NOT NULL,
	[BuildingNo] [NVARCHAR](20) NULL,
	[LayoutImg] [NVARCHAR](50) NULL,
	[CreatorId] [INT] NOT NULL,
	[CreateTime] [DATETIME] NOT NULL,
	[LastModifierId] [INT] NULL,
	[LastModifiedTime] [DATETIME] NULL,
 CONSTRAINT [PK_FloorRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[MaterialRecord](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[MaterialName] [VARCHAR](200) NOT NULL,
	[CompanyName] [VARCHAR](200) NULL,
	[ResponsibleName] [VARCHAR](200) NULL,
	[ResponsibleNum] [VARCHAR](20) NULL,
	[ImgUrl] [VARCHAR](200) NULL,
	[TagId] [VARCHAR](50) NOT NULL,
	[TagName] [VARCHAR](50) NOT NULL,
	[UpdateTime] [DATETIME] NULL,
	[ProductionDate] [DATETIME] NULL,
	[ProductionCompany] [NVARCHAR](50) NULL,
	[MaintenanceImg] [NVARCHAR](100) NULL,
	[InstallationCompany] [NVARCHAR](50) NULL,
	[CheckCompany] [NVARCHAR](50) NULL,
	[InstallationDate] [DATETIME] NULL,
	[CheckDate] [DATETIME] NULL,
	[DriverName] [NVARCHAR](50) NULL,
	[DriverNum] [VARCHAR](20) NULL,
	[InstallationCheckImg] [VARCHAR](200) NULL,
	[CreatorId] [INT] NOT NULL,
	[CreateTime] [DATETIME] NOT NULL,
	[LastModifierId] [INT] NULL,
	[LastModifiedTime] [DATETIME] NULL,
 CONSTRAINT [PK_MaterialRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[QualityRecord](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[TagId] [NVARCHAR](50) NOT NULL,
	[TagName] [VARCHAR](50) NOT NULL,
	[ImgUrl] [NVARCHAR](200) NULL,
	[Name] [VARCHAR](50) NOT NULL,
	[BuildingNo] [VARCHAR](50) NULL,
	[FloorNo] [VARCHAR](20) NULL,
	[BuildingMnnager] [VARCHAR](50) NULL,
	[BuildingManagerNum] [VARCHAR](20) NULL,
	[Inspector] [VARCHAR](50) NULL,
	[InspectorNum] [VARCHAR](20) NULL,
	[PouringDate] [DATETIME] NULL,
	[MaintananceDate] [DATETIME] NULL,
	[CheckDate] [DATETIME] NULL,
	[CheckData] [VARCHAR](100) NULL,
	[VerHorizontal] [NVARCHAR](100) NULL,
	[SlabThickness] [NVARCHAR](100) NULL,
	[RoofLevelness] [NVARCHAR](100) NULL,
	[Squareness] [NVARCHAR](100) NULL,
	[CreatorId] [INT] NOT NULL,
	[CreateTime] [DATETIME] NOT NULL,
	[LastModifierId] [INT] NULL,
	[LastModifiedTime] [DATETIME] NULL,
 CONSTRAINT [PK_QualityRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[SafetyAisleRecord](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[TagId] [NVARCHAR](50) NOT NULL,
	[TagName] [NVARCHAR](50) NOT NULL,
	[ImgUrl] [NVARCHAR](200) NULL,
	[Name] [VARCHAR](200) NOT NULL,
	[BasementAisle] [NVARCHAR](200) NULL,
	[CreatorId] [INT] NOT NULL,
	[CreateTime] [DATETIME] NOT NULL,
	[LastModifierId] [INT] NULL,
	[LastModifiedTime] [DATETIME] NULL,
 CONSTRAINT [PK_ExitRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[ScheduleRecord](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[TagId] [VARCHAR](50) NOT NULL,
	[TagName] [VARCHAR](50) NOT NULL,
	[ImgUrl] [VARCHAR](200) NULL,
	[CreatorId] [INT] NOT NULL,
	[CreateTime] [DATETIME] NOT NULL,
	[LastModifierId] [INT] NULL,
	[LastModifiedTime] [DATETIME] NULL,
	[Name] [NVARCHAR](50) NOT NULL,
	[BuildingNo] [NVARCHAR](20) NULL,
	[BuildingManager] [NVARCHAR](50) NULL,
	[BuildingManagerNum] [VARCHAR](20) NULL,
	[TeamManager] [NVARCHAR](50) NULL,
	[TeamManagerNum] [VARCHAR](20) NULL,
	[Description] [NVARCHAR](200) NULL,
 CONSTRAINT [PK_ScheduleRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[SecurityRecord](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[TitleName] [VARCHAR](200) NULL,
	[ProjectName] [VARCHAR](200) NULL,
	[MajorCompany] [VARCHAR](200) NULL,
	[ConstructionName] [VARCHAR](200) NULL,
	[ConcreteStrength] [VARCHAR](50) NULL,
	[Height] [VARCHAR](50) NULL,
	[PouringDate] [DATETIME] NULL,
	[Verticality] [VARCHAR](50) NULL,
	[Smoothness] [VARCHAR](50) NULL,
	[CrossSecDeviation] [VARCHAR](50) NULL,
	[AxisOffset] [VARCHAR](50) NULL,
	[Reviewer] [VARCHAR](200) NULL,
	[ResponsiblePerson] [VARCHAR](200) NULL,
	[ServicePerson] [VARCHAR](200) NULL,
	[ProjectProfile] [VARCHAR](200) NULL,
	[ImgUrl] [VARCHAR](200) NULL,
	[TagId] [VARCHAR](50) NOT NULL,
	[TagName] [VARCHAR](50) NOT NULL,
	[UpdateTime] [DATETIME] NULL,
 CONSTRAINT [PK_SecurityRecord] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]


ALTER DATABASE QrCodeTest SET  READ_WRITE 
GO

INSERT INTO dbo.Customer
        ( [UserName], [Password], [IsEnable] )
VALUES  ( 
          N'admin', -- UserName - nvarchar(32)
          '0b4e7a0e5fe84ad35fb5f95b9ceeac79', -- Password - varchar(32)
          1  -- IsEnable - bit
          )